﻿using CommunityToolkit.Mvvm.ComponentModel;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Reflection.Emit;
using System.Text;
using System.Threading.Tasks;

namespace ShanNiang.Mvvm.ViewModels
{
    public partial class BottleCodeViewModel : ObservableObject
    {
        public BottleCodeViewModel(string? bottleCode = null)
        {
            BottleCode = bottleCode;
        }
        /// <summary>
        /// 瓶码
        /// </summary>
        [ObservableProperty]
        private string? _bottleCode;

        protected override void OnPropertyChanged(PropertyChangedEventArgs e)
        {
            if (e.PropertyName == nameof(BottleCode))
            {
                OnPropertyChanged(nameof(Valid));
            }
            base.OnPropertyChanged(e);
        }

        public bool Valid => !string.IsNullOrEmpty(BottleCode);

    }
}
